import Foundation

@MainActor
class HomeViewModel: ObservableObject {
    @Published var components: [HomeComponent] = []
    @Published var isLoading = false
    
    private let componentsUseCase: ComponentsUseCase
    
    init(componentsUseCase: ComponentsUseCase) {
        self.componentsUseCase = componentsUseCase
    }
    
    func fetchComponents() {
        Task {
            isLoading = true
            do {
                components = try await componentsUseCase.fetchComponents()
            } catch {
                print("Error fetching components: \(error)")
            }
            isLoading = false
        }
    }
} 
